﻿@page "/doc"
@page "/doc/{slug}"

@inherits BaseComponent
@inject IOptions<SiteOption> SiteOptions
@inject AppService AppService

<PageTitle>@model?.Name - @SiteOptions.Value.AppTitle</PageTitle>

<UMenuBar Target="cl-doc-menu"/>
<div class="container cl-container cl-doc">
    <UDocMenu />
    <CmsCard>
        <div class="count">
            <i class="far fa-eye"/> @Random.Shared.Next(5, 1000)
        </div>
        <div class="cl-doc-body">
            @((MarkupString)model?.HtmlContent)
        </div>
    </CmsCard>
</div>

@code {
    private DocItem? model;

    [Parameter] public string? Slug { get; set; }

    protected override async Task OnInitAsync()
    {
        await base.OnInitAsync();

        model = await AppService.GetDocItemAsync(Slug);
    }

}